﻿

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using Freeform;



namespace Space_in_Shaders
{
    public class Crosshair : Entity
    {

        private InnerXHair Inner { get; set; }

        public Crosshair(World World)
            : base(World)
        {
            new Actor_Image2D(this, ((Game)Game).LoadAnimation("Crosshair"));
            Actor.Depth = 0.1f;
            Actor.ColourOverlay = new Color(254, 108, 29);

            SpatialProperties.Size = new Vector2(6, 6);

            //Inner = new InnerXHair(this);
        }

        public override void Update(GameTime time)
        {
            base.Update(time);

            SpatialProperties.Position = World.Viewports[0].MouseLocation_World;
        }


        protected override void OnDispose()
        {
            base.OnDispose();

            //Inner.Dispose();
        }
    }

    class InnerXHair : Entity
    {
        public Crosshair XHair { get; set; }
        public NMotion NMot { get; set; }

        public InnerXHair(Crosshair XHair)
            : base(XHair.World)
        {
            this.XHair = XHair;
            new Actor_Image2D(this, ((Game)Game).LoadAnimation("XHairInner"));
            Actor.Depth = 0.1f;
            Actor.ColourOverlay = new Color(29, 177, 254);

            NMot = new NMotion(SpatialProperties);
            NMot.Spin = 4f;
            NMot.TorqueResistance = 1f;
            SpatialProperties.Size = new Vector2(8, 8);
        }

        public override void Update(GameTime time)
        {
            base.Update(time);

            SpatialProperties.Position = XHair.SpatialProperties.Position;
        }
    }
}
